<%@page import="com.flute.haflute.web.ShutdownHelper"
	pageEncoding="utf-8"%>
<%@page import="java.io.FileNotFoundException"%>
<%
  String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>关闭系统</title>
		<link href="<%=path%>/css/admin.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/pub.css" rel="stylesheet" type="text/css" />
	</head>

	<body>
		<!--heaer start-->
		<div class="header">
			<img src="../images/SystemName.gif" />
		</div>
		<!--heaer end-->
					<div class="content">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="194" valign="top">
					<!--Start left-->
					<jsp:include page="/page/left_menu_admin.jsp" />
					<!--End left-->
				</td>
				<td width="799" valign="top">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td height="39" class="titletop"
								style="border-bottom: 1px dotted #ccc;"></td>
						</tr>
					</table>
					<br />
					<br />
					<br />
					<br />
					<table width="100%">
						<tr>
							<td>
								<%
			    boolean shutdown = request.getParameter("shutdown")!=null
			                       && request.getParameter("shutdown").equals("doit");
			                       
			    String title = "关闭服务";
			    int tab = 0;
			%>
								<title><%=title %></title>
								<% if(shutdown){ %>
								<p>
									<b>分布式爬虫系统已经被关闭!</b>
								</p>
								<p>
									网站的登录不再有效，软件必须重新启动后才能访问。
								</p>
								<p>
									<i>谢谢使用!</i>
								</p>
								<% } else { %>
								<script type="text/javascript">
			            function doShutDown(){
			                if (confirm("是否关闭服务?")){
			                    document.frmShutDown.shutdown.value = "doit";
			                    document.frmShutDown.submit();
			                }
			            }
			        </script>

								<form name="frmShutDown" method="post" action="shutdown.jsp">
									<input type="hidden" name="shutdown" />
								</form>

								<p>
									<b>你确定要关闭分布式爬虫服务器?</b>
								</p>
								<p>
									<span class="warning" style="color: red;"><b>警告:</b>
										这样做将结束当前的工作并且终止网站的访问 <br/>
											系统只有重新启动后才能使用
									</span>
								</p>
								<p>
									<input type="button" value="关闭" onClick="doShutDown()" />
									<input type="button" value="取消"
										onClick="document.location='<%=request.getContextPath()%>/index.jsp'" />
								</p>

								<% } %>

								<% 
			   ShutdownHelper.shutdown(shutdown);
			%>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		</div>
	</body>
</html>